
function edit(emp_id,emp_name,opr_name){
	var url = 'edit_operator.html?'+emp_id+'?'+emp_name+'?'+opr_name;
	var config = 'dialogWidth:240px;dialogHeight:260px;scroll:no;status:no;';
	window.showModalDialog(url,'',config);
//	window.open(url,'',config);
};
function password_reset(emp_id){
	
	var url = '/storage/admin/pages/operator.do?method=passwordReset&d=' + new Date();
	url = url + '&emp_id='+emp_id;
	$.getJSON(url, {}, function(data){
		if(data=="true"){
			alert('密码重置成功');
		}else{
			alert('密码重置失败');
		}
	});
};
function selectOperator(){
	
	var emp_name = escape(escape(document.getElementById('emp_name').value));
	var emp_job = escape(escape(document.getElementById('emp_job').value));
	emp_job = emp_job==''?-1:emp_job;

	var url = '/storage/admin/pages/operator.do?method=selectOperator&d=' + new Date();
	url = url + '&emp_name='+emp_name;
	url = url + '&emp_job='+emp_job;
	
	$.getJSON(url, {}, function(data){
		$('#oprList').html('');

		var _max = get_max_line(470,25);
		
		for(var i=0;i<data.length;i++){
			var style_border = 0-(0-i-1)==data.length&&data.length>=_max?'style="border-bottom:0;"':'';
			var oprList = '';
			oprList = oprList + '<tr style="height:15px;" onmouseover="cbgcolor(this,0)" onmouseout="cbgcolor(this,1)">';
			oprList = oprList + '  <td class="list" '+style_border+' width="200" >'+data[i][1]+'</td>';
			oprList = oprList + '  <td class="list" '+style_border+' width="" >'+data[i][2]+'</td>';
			oprList = oprList + '  <td class="list" '+style_border+' width="200" >'+data[i][3]+'</td>';
			oprList = oprList + '  <td class="list" '+style_border+' width="150" ><a href="javascript:void(0)" onclick="password_reset('+data[i][0]+')">密码重置</a>&nbsp;|&nbsp;<a href="javascript:void(0)" onclick="edit('+data[i][0]+',\''+data[i][1]+'\',\''+data[i][2]+'\')">编辑</a></td>';
			oprList = oprList + '</tr>';
			$('#oprList').append(oprList);
		}
		if(data.length<_max){
			add_foot();
		}
	});
};
function add_foot(){
	var foot = '';
    foot = foot + '<tr>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="200" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="200" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="150" >&nbsp;</td>';
	foot = foot + '</tr>';
	$('#oprList').append(foot);
};
